﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnterpriseQualityInfoForCpp.aspx.cs" EnableEventValidation="false"
    Inherits="RN.ERP.Web.Enterprise.EnterpriseQualityInfoForCpp" %>
<%@ Register Src="~/UserControl/UCCorpQual.ascx" TagName="UCCorpQual" TagPrefix="UCCorpQual" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>资质明细</title>
    <link href="../Styles/style.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/style_msg.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/kendo.common.min.css" rel="stylesheet" />
    <link href="../Styles/kendo.default.min.css" rel="stylesheet" />
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />

    <script type="text/javascript" src="../Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/kendo.web.min.js"></script>
    <script type="text/javascript" src="../Scripts/iepngfix_tilebg.js"></script>
    <script type="text/javascript" src="../Scripts/json-data.js"></script>
    <script type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <style>
        .IE6png{behavior: url("/Scripts/iepngfix.htc");}
    </style>
    <script type="text/javascript">

        $(function () {

            $("#btnSubmit").click(function () {
                //取得验证图片begin
                var funcCode = "CorpZZ";
                var guid = $("#hdnQualityGuid").val();
                //end
                var result = CheckData().Result;
                var message = CheckData().Message;
                if (!result) {
                    $.ligerDialog.warn(message);
                    return;
                }
                var OperateType = $("#hdnOperateType").val();
                var dataStr = GetData("btnSubmit");
                if (OperateType == 'Add') {
                    $.getJSON("../Handlers/EnterpriseQualityInfoHandler.ashx", { "action": OperateType, "zzGuid": guid, "funcCode": funcCode, "data": dataStr, "rand": Math.random() }, function (data) {
                        var result = eval(data);

                        if (result.Result == true) {
                            $.ligerDialog.alert(result.Message);
                            top.ChildDialogCallBack = "BindQuality";
                            top.ChildDialogClose();
                            //                            parent.window.BindQuality();
                            //                            returnToParent();
                        } else {
                            //未上传的图片
                            if (data.Message == "img") {
                                $.ligerDialog.warn("资质扫描件必须上传！");
                                return false;
                            }
                            $.ligerDialog.alert(result.Message);
                        }

                    });
                }
                if (OperateType == 'Edit') {
                    $.getJSON("../Handlers/EnterpriseQualityInfoHandler.ashx", { "action": OperateType, "data": dataStr, "rand": Math.random() }, function (data) {
                        var result = eval(data);
                        if (result.Result == true) {
                            top.ChildDialogCallBack = "BindQuality";
                            top.ChildDialogClose();
                            //                            parent.window.BindQuality();
                            //                            returnToParent();
                        } else {
                            //未上传的图片
                            if (data.Message == "img") {
                                $.ligerDialog.warn("资质扫描件必须上传！");
                                return false;
                            }
                        }
                    });
                }
            }
        );
            $("#corpqual_zztype2").change(function () {
                var detailName = $("#corpqual_zztype").find("option:selected").text() + '-' + $("#corpqual_zztype2").find("option:selected").text();
                var kindid = $("#corpqual_zztype2").find("option:selected").val().split("@")[0];
                $("#hdnDetailName").attr("value", detailName);
                $("#hdnKindId").attr("value", kindid);
                $("#hdnGradeName").attr("value", "");

                $("#hdnGradeCode").attr("value", "");
            }
            );
            $("#corpqual_zzlev").change(function () {
                var gradeName = $("#corpqual_zzlev").find("option:selected").text();
                var gradeCode = $("#corpqual_zzlev").find("option:selected").val().split("@")[0];
                $("#hdnGradeName").attr("value", gradeName);

                $("#hdnGradeCode").attr("value", gradeCode);
            }
            );
            $("#chkIsMain").click(function () {
                var isMain = "false";
                if ($("#chkIsMain").is(":checked")) {
                    isMain = "true";
                }
                $("#hdnIsMain").attr("value", isMain);
            }
            );
            $("#btnCancel").click(function () {
                //                returnToParent();
                top.ChildDialogClose();
            });
            $("#btnUpload").click(function () {
                var guid = $("#hdnQualityGuid").val();
                $.ligerDialog.open({ url: "../UserControl/FileUploadList.aspx?filename=" + guid + "&FuncCode=CorpZZ", width: 650, height: 570, title: '', isResize: true });
                // window.radopen("../Person/PersonUploadFile.aspx?filename=" + guid + "&FuncCode=CorpZZ", "radWindowUpload");
                return false;
            }
            );
            $("#Imgzz").click(function () {
                var qualityGuid = $("#hdnQualityGuid").val();
                $.ligerDialog.open({ url: "../Enterprise/UploadFileShowList.aspx?filename=" + qualityGuid + "&funcCode=CorpZZ&sysCode=EF&fileType=.jpg", width: 800, height: 600, title: '', isResize: true, buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            });
            bindData();
            AfterUpload();
        }
    );
        function OnClientCloseImg(args) {
            var arg = args;
            if (arg) {
                if (arg.Result == 1) {
                    return;
                }
                AfterUpload();
            }
        }
        function returnToParent() {
            window.parent.$.ligerDialog.close(); ////关闭dialog
            parent.$(".l-dialog,.l-window-mask").hide(); ////去除父窗体遮罩层
        }
      
        function AfterUpload() {
            var guid = $("#hdnQualityGuid").val();
            var imgObj = $("#Imgzz");
            imgObj.attr("src", "../Handlers/GetFileHandler.ashx?fileName=" + guid + ".jpg&sysCode=EF" + "&funcCode=CorpZZ" + "&rand=" + Math.random());
            imgObj.show();
        }

        function bindData() {
            var type = $("#hdnOperateType").val();
            if (type == "Edit") {
                var detailName = $("#corpqual_zztype").find("option:selected").text() + '-' + $("#corpqual_zztype2").find("option:selected").text();
                var kindid = $("#corpqual_zztype2").find("option:selected").val().split("@")[0];
                $("#hdnDetailName").attr("value", detailName);
                $("#hdnKindId").attr("value", kindid);
                var gradeName = $("#corpqual_zzlev").find("option:selected").text();
                var gradeCode = $("#corpqual_zzlev").find("option:selected").val().split("@")[0];
                $("#hdnGradeName").attr("value", gradeName);

                $("#hdnGradeCode").attr("value", gradeCode);
            }
        }
        function CheckData() {
            var kindId = $("#hdnKindId").val();
            var grade = $("#hdnGradeCode").val();
            var code = $("#txtQualityCode").val();
            var start = $("#txtGetDate").val();
            var end = $("#txtzzzEndDate").val();
            if (kindId == null || kindId == '') {
                return {Result:false,Message:'请选择资质类型'};
            }
            var grades = $("#corpqual_zzlev").children();
            if (grades.length>1&&(grade == null || grade == '')) {
                return { Result: false, Message: '请选择资质等级' };
            }
            if (code == null || code == '') {
                return { Result: false, Message: '资质证书本编号不能为空' };
            }
            if (start == null || start == '') {
                return { Result: false, Message: '资质获得时间不能为空' };
            }
//            if (end == null || end == '') {
//                return { Result: false, Message: '资质有效期至不能为空' };
//            }
            return { Result: true, Message: '' }; 
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table width="770" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
            <td width="16" class="title_lbg IE6png">
            </td>
            <td width="24" class="title_t IE6png">
            </td>
            <td width="713" class="title_libg IE6png">
                企业资质
            </td>
            <td width="17" class="title_rbg IE6png">
            </td>
        </tr>
        <tr>
            <td class="border_lbg IE6png">
                &nbsp;<input type="hidden" id="hdnOperateType" runat="server" />
                <input type="hidden" id="hdnEditModel" runat="server" />
            </td>
            <td colspan="2" style="padding-top: 16px; padding-left: 6px; padding-right: 6px;">
                <table width="510" border="0" cellspacing="0" cellpadding="0" class="xx_tab" align="center"
                    id="tb_corp_quality" table="tb_corp_quality" valtype="0">
                    <tr>
                        <td width="130" align="right">
                            是否主项
                        </td>
                        <td width="152">
                            <asp:CheckBox ID="chkIsMain" runat="server" />
                            <input id="hdnIsMain" type="hidden" runat="server" control="IsMain" value="false" />
                        </td>
                        <td width="152">
                            &nbsp;
                            <input type="hidden" id="hdnCorpUserGuid" runat="server" control="CorpUserGuid" />
                            <input type="hidden" id="hdnQualityGuid" runat="server" control="QualityGuid" />
                        </td>
                        <td width="76">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                    
                    <td colspan="3" >
                    <div style=" margin-left:60px;">
                    <UCCorpQual:UCCorpQual ID="corpqual" runat="server" />
                    
                    </div>
                    <input id="hdnDetailName" runat="server" type="hidden" control="DetailName" />
                    <input id="hdnGradeName" runat="server" type="hidden" control="GradeName" />
                    <input id="hdnGradeCode" runat="server" type="hidden" control="GradeCode" />
                    <input id="hdnKindId" runat="server" type="hidden" control="KindId" />
                    </td>
                    </tr>
                    <tr>
                        <td align="right">
                            资质证书本编号
                        </td>
                        <td colspan="3">
                            <div class="s_input">
                                <span class="input_l">
                                    <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                        <asp:TextBox ID="txtQualityCode" runat="server" Style="width: 275px; height: 31px;
                                            line-height: 31px; border: 0; background: transparent" Control="QualityCode"></asp:TextBox>
                                    </span><span class="input_r">
                                        <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            资质获得时间
                        </td>
                        <td colspan="3">
                            <div class="s_input">
                                <span class="input_l">
                                    <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                        <input id="txtGetDate" name="text" runat="server" type="text" value="" style="width: 275px;
                                            height: 31px; line-height: 31px; border: 0; background: transparent; overflow: hidden"
                                            control="GetDate" onclick="WdatePicker({skin:'blue',maxDate:'#F{$dp.$D(\'txtzzzEndDate\')}'})" />
                                    </span><span class="input_r">
                                        <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            资质有效期至
                        </td>
                        <td colspan="3">
                            <div class="s_input">
                                <span class="input_l">
                                    <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span class="input_mm">
                                        <input id="txtzzzEndDate" runat="server" name="text" type="text" value="" style="width: 275px;
                                            height: 31px; line-height: 31px; border: 0; background: transparent; overflow: hidden"
                                            control="zzzEndDate"  onclick="WdatePicker({skin:'blue',minDate:'#F{$dp.$D(\'txtGetDate\')}'})"/>
                                    </span><span class="input_r">
                                        <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                            </div>
                        </td>
                    </tr>
                   
                    <tr>
                        <td align="right" >
                            资质扫描件
                        </td>
                        <td colspan="2">
                            <div>
                                <asp:Image ID="Imgzz" runat="server" CssClass="pointer" Width="200px" Height="100px"/>
                            </div>
                        </td>
                        <td style="padding: 0">
                           <asp:Button ID="btnUpload" Text="上传" CssClass="pointer" runat="server" Style="width: 60px; height: 31px;
                                border: 0; background: url(../images/btn_bg.jpg) left top no-repeat; padding: 0;
                                margin: 0;"  />
                        </td>
                    </tr>
                </table>
                <table width="90%" height="80" border="0" align="center" cellpadding="0" cellspacing="0"
                    class="xx_tab">
                    <tr>
                        <td width="136" height="80">
                            &nbsp;
                        </td>
                        <td width="190" height="80">
                            <%--<asp:Button ID="btnSubmit" runat="server" Text="保存" CssClass="icon01 IE6png" parentdiv="tb_corp_quality"
                                ></asp:Button>--%>
                            <input id="btnSubmit" type="button" runat="server" value="保存" class="icon01 IE6png" parentdiv="tb_corp_quality" />
                        </td>
                        <td width="11" height="80">
                            &nbsp;
                        </td>
                        <td width="190" height="80">
                            <asp:Button ID="btnCancel" runat="server" Text="取消" CssClass="icon02 IE6png"></asp:Button>
                        </td>
                        <td width="136" height="80">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </td>
            <td class="border_rbg IE6png">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="border_lconer IE6png" headers="17">
                &nbsp;
            </td>
            <td colspan="2" class="border_bottomli IE6png" height="17">
                &nbsp;
            </td>
            <td class="border_rconer IE6png" headers="17">
                &nbsp;
            </td>
        </tr>
    </table>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue">
        <Windows>
            <telerik:RadWindow ID="radWindowUpload" runat="server" Width="600px" Height="300px"
                OnClientClose="AfterUpload">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    </form>
</body>
</html>
